from rest_framework.response import Response


class APIResponse(Response):
    def __init__(self, code=100, msg='成功', result=None, status=None, headers=None, content_type=None, **kwargs):
        data = {
            'code': code,
            'msg': msg,
        }
        if result:
            data['result'] = result

        data.update(kwargs)

        super(APIResponse, self).__init__(data=data, status=status, headers=headers, content_type=content_type)
